package com.avcdata.aoscustommade.presenter;

import com.avcdata.aoscustommade.main.BaseCallBack;
import com.avcdata.aoscustommade.model.SelectAgencyModel;
import com.avcdata.aoscustommade.view.SelectAgencyView;

import org.json.JSONObject;

import java.util.ArrayList;

/**
 * 办事处选择的p
 * Created by zyh on 17/6/12.
 */

public class SelectAgencyPresenter {
    private final SelectAgencyView selectAgencyView;
    private final SelectAgencyModel selectAgencyModel;

    public SelectAgencyPresenter(SelectAgencyView selectAgencyView, SelectAgencyModel selectAgencyModel) {
        this.selectAgencyView = selectAgencyView;
        this.selectAgencyModel = selectAgencyModel;
    }

    /**
     * 下降数据
     *
     * @param lastWeek
     * @param detailData
     */
    public void loadDecline(String lastWeek, ArrayList<String> detailData) {
        selectAgencyModel.loadDecline(lastWeek, detailData, new BaseCallBack() {
            @Override
            public void onSuccess(Object object) {
                selectAgencyView.loadDeclineSuccess((JSONObject) object);
            }

            @Override
            public void onFailure() {
                selectAgencyView.loadDeclineFailure();
            }

            @Override
            public void onFailure(Throwable throwable) {
                selectAgencyView.loadDeclineFailure(throwable);
            }
        });
    }
}
